package com.hsjk.szwj.module.official.dal.mysql.unit;

import com.hsjk.szwj.framework.common.pojo.PageResult;
import com.hsjk.szwj.framework.mybatis.core.mapper.BaseMapperX;
import com.hsjk.szwj.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.hsjk.szwj.module.official.controller.admin.unit.vo.AdminModuleDiyPageReqVO;
import com.hsjk.szwj.module.official.controller.app.unit.vo.AppModuleDiyPageReqVO;
import com.hsjk.szwj.module.official.dal.dataobject.unit.OfficialWebsiteModuleDiyDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * @author chenjiawei
 * @desc
 * @Date 2023/11/24 00:07
 **/
@Mapper
public interface IOfficialWebsiteModuleDiyMapper extends BaseMapperX<OfficialWebsiteModuleDiyDO> {
    default PageResult<OfficialWebsiteModuleDiyDO> selectAdminPage(AdminModuleDiyPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OfficialWebsiteModuleDiyDO>()
                .eqIfPresent(OfficialWebsiteModuleDiyDO::getDiyName, reqVO.getDiyName())
                .orderByDesc(OfficialWebsiteModuleDiyDO::getCreateTime));
    }

    default PageResult<OfficialWebsiteModuleDiyDO> selectAppPage(AppModuleDiyPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OfficialWebsiteModuleDiyDO>()
                .eqIfPresent(OfficialWebsiteModuleDiyDO::getDiyName, reqVO.getDiyName())
                .orderByDesc(OfficialWebsiteModuleDiyDO::getCreateTime));
    }
}
